package com.liaozhai.community.dao;

import com.liaozhai.community.entity.LoginTicket;
import org.apache.ibatis.annotations.*;

@Mapper
public interface LoginTicketMapper {


    @Insert("insert into login_ticket (user_id, ticket, status, expired) " +
            "values (#{userId},#{ticket},#{status},#{expired});")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    public int insertLoginTicket(LoginTicket loginTicket);

    @Select("select id, user_id, ticket, status, expired from login_ticket " +
            "where ticket = #{ticket}")
    public LoginTicket selectByTicket(String ticket);

    @Update("update login_ticket set status = #{status} where ticket = #{ticket}")
    public int updateStatus(String ticket,int status);
}
